package cn.iocoder.yudao.module.project.dal.mysql.kisbom;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.controller.admin.order.vo.PreparationVO;
import cn.iocoder.yudao.module.project.dal.dataobject.kisbom.KisBomDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.kisbom.vo.*;
import org.springframework.data.repository.query.Param;

/**
 * bom数据 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface KisBomMapper extends BaseMapperX<KisBomDO> {

    default PageResult<KisBomDO> selectPage(KisBomPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KisBomDO>()
                .betweenIfPresent(KisBomDO::getReceiptDate, reqVO.getReceiptDate())
                .likeIfPresent(KisBomDO::getType, reqVO.getType())
                .likeIfPresent(KisBomDO::getCode, reqVO.getCode())
                .likeIfPresent(KisBomDO::getSpecification, reqVO.getSpecification())
                .betweenIfPresent(KisBomDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(KisBomDO::getId));
    }




    List<KisBomDO> selectSavedList(Map<String, Object> params);

    void insertList(List<KisBomDO> insertList);

    void updateList(List<KisBomDO> updateList);

    List<PreparationVO> selectBomListByType(@Param("type") String type);

    List<String> selectTypeList(@Param("type") String type);

    List<PreparationVO> selectCodeListByType(@Param("type") String type);

    Long countBomList(Map<String, Object> params);

    List<KisBomRespVO> selectBomList(Map<String, Object> params);

    int deleteBomByType(String type);

}